﻿using System;
using System.Collections.Generic;
using Framework;
namespace Enterprise.Admin.Handle
{
    /// <summary>
    /// 获取文章分类JSON
    /// </summary>
    public partial class GetArticleCategoryTreeJson : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var articleCategoryService = new ArticleCategoryService();
            var tables = articleCategoryService.GetTable();
            var result = new { total = tables.Total, rows = new List<object>() };
            foreach (System.Data.DataRow item in tables.Rows)
            {
                result.rows.Add(new
                {
                    id = item["CoArticleCategoryId"].SafeToInt(),
                    CoName = item["CoName"].SafeToString(),
                    CoNameEn = item["CoNameEn"].SafeToString(),
                    _parentId = item["CoParentId"].SafeToString(),
                    CoDepth = item["CoDepth"].SafeToInt(),
                    CoSort = item["CoSort"].SafeToInt()
                });
            }
            Json(result);
        }
    }
}